import { DeployPanelItem } from "../DeployPanelItem";
import { GLabel } from "../../../../../../com/mui/controls/GLabel";
import { FilterConst } from "../../../../../component/gconst/FilterConst";
import { GTextFormat } from "../../../../../common/GTextFormat";
import { GButton } from "../../../../../../com/mui/controls/GButton";
import { ItemData } from "../../../../resource/info/ItemData";
import { LoaderManager } from "../../../../../../com/gengine/resource/LoaderManager";
import { SWFInfo } from "../../../../../../com/gengine/resource/info/SWFInfo";
import { Vector } from "../../../../../../__AS3__/vec/Vector";
type int = number;
//class BaseDeployPanel
    
    export  class BaseDeployPanel /* flash.display.Sprite */
    {
        constructor()
        {
            
            this.allItem = new Vector.<DeployPanelItem>();
            this.createChildren();
            return;
        }

        public get isEnoughMoney(): Boolean
        {
            return this._isEnoughMoney;
        }

        public set isEnoughMoney(arg1: Boolean)
        {
            this._isEnoughMoney = arg1;
            this.updateStatus();
            return;
        }

        public set successRate(arg1: int)
        {
            if (arg1 > 100) 
            {
                arg1 = 100;
            }
            if (arg1 < 0) 
            {
                arg1 = 0;
            }
            this.successRateLabel.htmlText = arg1 + "%";
            this._successRate = arg1;
            return;
        }

        public get successRate(): int
        {
            return this._successRate;
        }

        protected updateStatus(): void
        {
            return;
        }

        protected createChildren(): void
        {
            this.successRateItem = new Object /* flash.display.Sprite */();
            this.successRateLabel = new GLabel();
            this.successRateLabel.x = 197;
            this.successRateLabel.y = 86;
            this.successRateLabel.width = 70;
            this.successRateLabel.height = 25;
            this.successRateLabel.textField.filters = [FilterConst.glowFilter];
            this.successRateItem.addChild(this.successRateLabel);
            var loc1=new GTextFormat();
            loc1.color = 6749728;
            loc1.size = 20;
            loc1.align = flash.text.TextFormatAlign.LEFT;
            this.successRateLabel.setStyle("textFormat", loc1);
            this.confirmButton = new GButton();
            this.confirmButton.styleName = "ButtonSpecial";
            this.confirmButton.x = 121;
            this.confirmButton.y = 226;
            this.confirmButton.width = 68;
            this.confirmButton.height = 26;
            this.successRate = 0;
            return;
        }

        public putInItem(arg1: ItemData, arg2: Boolean=false, arg3=null): void
        {
            return;
        }

        public onUpdateStatus(): void
        {
            this.updateStatus();
            return;
        }

        public onUpdateResult(arg1: int, arg2: Boolean, arg3, arg4: Array<any>): void
        {
            return;
        }

        public addUpdateSuccessEffect(arg1: string, arg2: int=0, arg3: int=0): void
        {
            this._ex = arg2;
            this._ey = arg3;
            LoaderManager.instance.load(arg1, this.onEffectLoaded);
            return;
        }

        /* internal  */onEffectLoaded(arg1: SWFInfo): void
        {
            var loc1=arg1.clip;
            loc1.x = this._ex - 200;
            loc1.y = this._ey - 200;
            loc1.gotoAndStop(1);
            loc1.addEventListener(flash.events.Event.ENTER_FRAME, this.onMcEnterFrame, false, 0, true);
            this.addChild(loc1);
            loc1.play();
            return;
        }

        /* internal  */onMcEnterFrame(arg1: Object /* flash.events.Event */): void
        {
            var loc1=arg1.target as Object /* flash.display.MovieClip */;
            if (loc1.currentFrame == loc1.totalFrames) 
            {
                loc1.stop();
                loc1.removeEventListener(flash.events.Event.ENTER_FRAME, this.onMcEnterFrame, false);
                if (loc1.parent) 
                {
                    loc1.parent.removeChild(loc1);
                }
                loc1 = null;
            }
            return;
        }

        public setAutoChooseMaterial(arg1: Object): void
        {
            return;
        }

        public clearAllItem(): void
        {
            var loc1=0;
            while (loc1 < this.allItem.length) 
            {
                this.allItem[loc1].itemData = null;
                this.allItem[loc1].enabled = true;
                ++loc1;
            }
            return;
        }

        public setAutoChooseLuckTune(arg1: Object): void
        {
            return;
        }

        public clear(): void
        {
            return;
        }

        public guideEquipOpt(arg1: Function, arg2: Boolean): void
        {
            return;
        }

        public hideGuide(): void
        {
            return;
        }

        public hide(): void
        {
            return;
        }

        protected /* var */allItem: Vector.<DeployPanelItem>;

        protected /* var */successRateLabel: GLabel;

        public /* var */confirmButton: GButton;

        protected /* var */successRateItem: Object /* flash.display.Sprite */;

        protected /* var */_cost: int;

        /* internal */ /* var */_isEnoughMoney: Boolean;

        public /* var */canOperate: Boolean;

        /* internal */ /* var */_successRate: int=0;

        /* internal */ /* var */_ex: int;

        /* internal */ /* var */_ey: int;
    }
